<?php

ini_set('display_errors',1);

// PHP Class
class Person {

	private $id;

	public $first_name;
	public $last_name;

	static $total_count = 0;

	public function __construct( $first_name, $last_name ) {

		$this->id = self::$total_count++;

		$this->first_name = $first_name;
		$this->last_name = $last_name;

	}

	public function getFullName() {

		return $this->first_name . ' ' . $this->last_name;

	}

	public function getId() {

		return $this->id;

	}

}

// Object instantiation
$mike = new Person( 'Mike', 'Burns' );

// Accessing a public property
echo $mike->first_name . '<br>';
// Output:
// "Mike"

// Accessing a private property
// echo $mike->id;
// Output:
// Fatal error: Cannot access private property Person::$id

echo $mike->getId()  . '<br>';
// Output
// 0

// Calling an object method
echo $mike->getFullName() . '<br>';
// Output:
// "Mike Burns"

// Creating another person
$heather = new Person( 'Heather', 'Stebbins' );

echo $heather->getId()  . '<br>';
// Output
// 1

// Accessing a static property
echo 'Person count: ' . Person::$total_count . '<br>';